/*
 * @Author: 专送Pro
 * @Date: 2019-08-23 13:17:18
 * @LastEditors  : wuzhen
 * @LastEditTime : 2020-01-11 13:12:54
 * @Description: 配置文件
 */
export default {
  data() {
    return {
      // 搜索参数配置
      searchProps: [
        {
          label: "注册时间",
          type: "daterange",
          key: "date",
          placeholder: "请选择注册时间"
        },
        {
          label: "登录状态",
          type: "select",
          key: "onlinestatus",
          placeholder: "请选择登录状态",
          options: {
            data: [
              {
                label: "在线",
                value: 20
              },
              {
                label: "离线",
                value: 10
              }
            ]
          }
        },
        {
          label: "账户状态",
          type: "select",
          key: "status",
          placeholder: "请选择账户状态",
          options: {
            data: [
              {
                label: "正常",
                value: 10
              },
              {
                label: "违规停用",
                value: 40
              }
            ]
          }
        }
      ],
      columns: [
        {
          title: "用户ID",
          width: 120,
          key: "userid"
        },
        {
          title: "用户昵称",
          key: "username"
        },
        {
          title: "手机号码",
          key: "mobile"
        },
        {
          title: "性别",
          width: 80,
          render: (h, params) => {
            const row = params.row;
            return h(
              "span",
              row.gender === 4 ? "女" : row.gender === 2 ? "男" : "未知"
            );
          }
        },
        {
          title: "注册时间",
          render: (h, params) => {
            const row = params.row;
            return h("span", this.$fmtMoment(row.createtime));
          }
        },
        {
          title: "登录状态",
          render: (h, params) => {
            const row = params.row;
            return h("Badge", {
              props: {
                status: row.onlinestatus === 20 ? "processing" : "default",
                text: row.onlinestatus === 20 ? "在线" : "离线"
              }
            });
          }
        },
        {
          title: "最后上线时间",
          render: (h, params) => {
            const row = params.row;
            return h("span", this.$fmtMoment(row.logouttime) || "--");
          }
        },
        {
          title: "账户状态",
          render: (h, params) => {
            const row = params.row;
            return h(
              "Tag",
              {
                props: {
                  color: row.status === 10 ? "success" : "error"
                }
              },
              row.status === 10 ? "正常" : "违规停用"
            );
          }
        },
        {
          title: "操作",
          slot: "action"
        }
      ],
      handleBtn: [
        {
          slot: "action",
          btnType: "action"
        }
      ]
    };
  }
};
